package com.xindz.hgq.main;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;

import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.SPUtils;
import com.xindz.hgq.R;

import java.util.concurrent.TimeUnit;

import butterknife.ButterKnife;
import butterknife.Unbinder;
import io.reactivex.Observable;
import io.reactivex.functions.Consumer;

/**
 * @name HGQBase
 * @class name：com.xindz.hgq
 * @describe describe
 * @anthor XINDZ
 * @time 2018/1/2 10:25
 * @change
 * @chang time
 * @class describe
 */
public class LaunchActivity extends Activity {

    private Unbinder bind;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.actvity_launch);
        bind = ButterKnife.bind(this);

        Observable.timer(1, TimeUnit.SECONDS).subscribe(new Consumer<Long>() {
            @Override
            public void accept(Long aLong) throws Exception {
                boolean guide = SPUtils.getInstance().getBoolean("Guide", true);
                if (guide){
                    ActivityUtils.startActivity(GuideActivity.class);
                }else {
                    ActivityUtils.startActivity(MainActivity.class);
                }

                finish();
            }
        });



    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        bind.unbind();
    }

}
